package com.zzh.controller;

import com.github.pagehelper.PageInfo;
import com.zzh.domain.Resource;
import com.zzh.domain.ResourseVo;
import com.zzh.domain.ResponseResult;
import com.zzh.domain.Role;
import com.zzh.service.ResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/ResourceCategory")
public class ResourceController {

    @Autowired
    private ResourceService resourceService;

    @RequestMapping("/findAllResourceCategory")
    public ResponseResult findAllResourceCategory() {
        List<Role> roles = resourceService.findAllResourceCategory();
        return new ResponseResult(true, 200, "成功响应", roles);
    }

    @RequestMapping("/findAllResource")
    public ResponseResult findAllResource(@RequestBody ResourseVo resourseVo) {
        PageInfo<Resource> pageInfo = resourceService.findAllResource(resourseVo);
        return new ResponseResult(true, 200, "成功响应", pageInfo);
    }
}
